package Euler357;

import java.util.List;
import ReusableCode.*;

public class PrimeGeneratingIntegers {

	public static void main(String[] args) {
		long sum = 1 + 2 + 6;
		
		for(int i = 10; i <= 100000000; i+=2){
			int digit = MathFunctions.getDigit(i, 1) ;
			if(digit == 2 || digit == 0 || digit == 8)
			{
				if(PrimeFunctions.isPrimeGenerating(i)){
					sum += i;
					//System.out.println(i);
				}
			}
		}
		
		System.out.println(sum);
	}
}
